/**
 * Author:   YASUO
 * Date:     2018/7/11 14:01
 * Description: 财富类型
 */
package com.rljk.common.consts;

import com.rljk.common.result.CodeMsg;
import com.rljk.exception.GlobalException;

public enum WealthTypeEnum {

    ENERGY(1,"能量"),
    XW(2,"XW链"),
    INTEGRAL(3,"积分"),
    LUCKY_DRILL(4,"幸运钻");

    private int code;
    private String name;

    WealthTypeEnum(int code, String name) {
        this.code = code;
        this.name = name;
    }


    public static String getName(int code) {
        for (WealthTypeEnum c : WealthTypeEnum.values()) {
            if (c.getCode() == code) {
                return c.name;
            }
        }
        throw new GlobalException(CodeMsg.ENUM_NOT_FIND);
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }
}
